home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #9
/
Amiga Plus CD - 2004 - No. 09.iso
/
amigaplus
/
tools
/
amigaos4_only
/
ifxlite
/
imagefx3
/
rexx
/
wimp.ifx
< prev
next >
Wrap
Text File
|
2004-08-03
|
4KB
|
197 lines
/*
* $VER: WIMP 1.00.00 (24.9.92)
*
* Arexx program for the ImageFX image processing system.
* Written by Thomas Krehbiel
*
* WIMP - Wildcard ImageFX Multi Processor
*
* Given a wildcard pattern, this program will perform user-supplied
* commands on the series and output 24-bit frames or rendered frames.
*/
OPTIONS RESULTS
SIGNAL ON BREAK_C
inpattern = GETCLIP('WIMP_In')
outpattern = GETCLIP('WIMP_Out')
prepcmd = GETCLIP('WIMP_Prep')
proccmd = GETCLIP('WIMP_Proc')
loadopt = GETCLIP('WIMP_LoadOpt')
Gadget.1 = 'S/120/20/Input Pattern:/'inpattern
Gadget.2 = 'S/120/35/Output Pattern:/'outpattern
Gadget.3 = 'S/120/50/Prep:/'prepcmd
Gadget.4 = 'S/120/65/Proc:/'proccmd
Gadget.5 = 'S/120/80/Load Options:/'loadopt
Gadget.6 = 'C/120/95/Output:/3/24-Bit/Rendered/ANIM'
ComplexRequest '"WIMP - Wildcard ImageFX Multi Processor"' 6 Gadget 300 130
IF rc ~= 0 THEN EXIT
inpattern = result.1
outpattern = result.2
prepcmd = result.3
proccmd = result.4
loadopt = result.5
output = result.6
CALL SETCLIP('WIMP_In', inpattern)
CALL SETCLIP('WIMP_Out', outpattern)
CALL SETCLIP('WIMP_Prep', prepcmd)
CALL SETCLIP('WIMP_Proc', proccmd)
CALL SETCLIP('WIMP_LoadOpt', loadopt)
i = INDEX(outpattern, '#?')
IF i ~= 0 THEN DO
preout = LEFT(outpattern, i-1)
postout = SUBSTR(outpattern, i+2)
END
ELSE DO
i = INDEX(outpattern, '*')
IF i ~= 0 THEN DO
preout = LEFT(outpattern, i-1)
postout = SUBSTR(outpattern, i+1)
END
END
/* determine input directory path */
indir = ''
i = LASTPOS('/', inpattern)
IF i = 0 THEN i = LASTPOS(':', inpattern)
IF i ~= 0 THEN DO
indir = LEFT(inpattern, i)
END
/* list all files matching the pattern */
ADDRESS COMMAND 'c:List >RAM:__WIMP_TEMP__ NOHEAD LFORMAT='indir'%s' inpattern
IF rc ~= 0 THEN DO
RequestNotify 'Error listing pattern files.'
EXIT
END
/* sort alphabetically */
ADDRESS COMMAND 'c:Sort RAM:__WIMP_TEMP__ TO RAM:__WIMP_LIST__'
ADDRESS COMMAND 'c:Delete RAM:__WIMP_TEMP__ QUIET'
IF prepcmd ~= "" THEN INTERPRET prepcmd
IF rc ~= 0 THEN EXIT
IF ~OPEN(infile, 'RAM:__WIMP_LIST__', 'Read') THEN DO
RequestNotify 'Cannot read pattern files.'
EXIT
END
Undo Off
LockInput
IF output = 2 THEN DO
LockRange 0 ON
CreateBuffer 320 200
IF proccmd ~= "" THEN INTERPRET proccmd
IF rc ~= 0 THEN EXIT
Render Go
SaveRenderedAs ANIM '"'outpattern'"' Append Keep
END
f = 1
/* go through the list one by one */
DO WHILE ~EOF(infile)
nextfile = READLN(infile)
IF nextfile ~= "" THEN DO
Render Close
files.f = nextfile; f = f + 1
Message nextfile
LoadBuffer '"'nextfile'"' Force loadopt
IF rc ~= 0 THEN DO
RequestNotify 'Error loading file ('rc').'
LEAVE
END
Redraw Off
sub = LASTPOS('/', nextfile)
IF sub = 0 THEN sub = LASTPOS(':', nextfile)
sub = sub + 1
ext = LASTPOS('.', nextfile)
IF ext = 0 THEN ext = LENGTH(nextfile) + 1
substr = SUBSTR(nextfile, sub, ext - sub) /* base filename, no ext */
IF proccmd ~= "" THEN INTERPRET proccmd
IF rc ~= 0 THEN LEAVE
Redraw On
SELECT
WHEN output = 0 THEN DO
SaveBufferAs ILBM '"'preout||substr||postout'"'
END
WHEN output = 1 THEN DO
Render Go
SaveRenderedAs ILBM '"'preout||substr||postout'"'
Render Close
END
WHEN output = 2 THEN DO
Render Go
SaveRenderedAs ANIM '"'outpattern'"' Append Keep
SaveRenderedAs ANIM '"'outpattern'"' Append Keep
END
OTHERWISE NOP
END
END
END
CALL CLOSE(infile)
IF output = 2 THEN DO
CreateBuffer 320 200
IF proccmd ~= "" THEN INTERPRET proccmd
Render Go
SaveRenderedAs ANIM '"'outpattern'"' Append Keep
LoadBuffer '"'files.1'"' Force loadopt
IF proccmd ~= "" THEN INTERPRET proccmd
Render Go
SaveRenderedAs ANIM '"'outpattern'"' Append Keep
LoadBuffer '"'files.2'"' Force loadopt
IF proccmd ~= "" THEN INTERPRET proccmd
Render Go
SaveRenderedAs ANIM '"'outpattern'"' Append Keep
SaveRenderedAs ANIM '"'outpattern'"' Close
Render Close
END
ADDRESS COMMAND 'c:Delete RAM:__WIMP_LIST__ QUIET'
KillBuffer Force
UnlockInput
Undo On
EXIT
BREAK_C:
IF output = 2 THEN DO
Render Go
SaveRenderedAs ANIM junk Close
END
KillBuffer Force
UnlockInput
Undo On
EXIT